package operation;

import book.Book;
import book.Booklist;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: XMQ
 * Date: 2022-05-18
 * Time: 8:20
 */
public class ReturnOperation implements IOperation {

    @Override
    public void work(Booklist booklist) {
        System.out.println("归还图书！");
        System.out.println("请你输入你要归还的书名：");
        Scanner scan = new Scanner(System.in);
        String name = scan.nextLine();
        for (int i = 0; i <booklist.getUseSize() ; i++) {
            if (booklist.getBooks(i).getName().equals(name)) {
                booklist.getBooks(i).setBoolean(false);
                System.out.println("归还成功！");
                return;
            }
        }
    }
}
